/********************************************************************
	created:	2010/04/19
	created:	19:4:2010   12:21
	filename: 	qyZipEntry.h
	author:		Xiong Jiayu
	purpose:	
*********************************************************************/
#pragma once

#ifndef __QYZIPENTRY_H__
#define __QYZIPENTRY_H__

#include "../common/qyCommon.h"
#include "../memsys/qyString.h"
#include "../memsys/qyArray.h"

/*
===========================================
class qyZipEntry
===========================================
*/
class qyZipEntry
{
public:
						qyZipEntry();
	virtual				~qyZipEntry();

	void				Setup( const qyString &entryPath, const qyString &token );
	const qyString &	GetPath( void ) const;
	const qyString &	GetToken( void ) const;
	bool				IsDirectory( void ) const;
	qyZipEntry *		AddSubEntry( const qyString &path, const qyString &token );
	int					NumSubEntry( void ) const;
	qyZipEntry *		GetSubEntryAt( const int index );
	qyZipEntry *		FindDirEntry( const qyString &path );
protected:

protected:
	qyString		m_pathInZip;
	qyString		m_token;
	typedef qyArray<qyZipEntry *>	ChildrenList;
	ChildrenList	m_children;
	bool			m_isDirectory;
};

//-----------------------------------------------------------------------
QY_INLINE bool qyZipEntry::IsDirectory() const
{
	return m_isDirectory;
}

//-----------------------------------------------------------------------
QY_INLINE const qyString & qyZipEntry::GetPath( void ) const
{
	return m_pathInZip;
}

//-----------------------------------------------------------------------
QY_INLINE const qyString & qyZipEntry::GetToken( void ) const
{
	return m_token;
}

#endif
 
